fix(extract-plan): replace broken (?R) recursive regex with depth-tracking parser#130
Conversation
(?R) in perl recursively applies the full outer pattern, which requires
every nested {} to contain "version":"<version>" — causing extraction to
fail whenever the action plan has nested objects like params:{...} inside
an action entry (e.g. escalate action with reason+labels params).
Replace the recursive regex in Strategies B2, C (issue) and C (pr) with
a character-by-character depth tracker that:
1. Walks the input finding balanced {…} blocks (tracking strings/escapes)
2. Filters candidates by /"version"\s*:\s*"$v"/ on the full block text
3. Returns the last match so multi-attempt runs use the final output
Strategy E (issue) is fixed the same way, filtering by /"actions"\s*:\s*\[/
instead; the jq validation step that follows still checks version+type.
Adds a regression test (issue #93) that embeds a plan with nested params
objects in a markdown code-fence and confirms it is extracted correctly.
Three pre-existing issues blocked `git push` via the lefthook pre-push: 1. actionlint-full: auto-release.yml had shellcheck-reported SC2001/SC2086/ SC2129 findings (sed → param-expansion, unquoted vars, grouped redirects). 2. verify-sha: docs.yml referenced b96e013b but manifest.yml pinned 4e1ecad; commit 2c283d8 updated the workflow without updating the manifest. Fixed by reverting docs.yml to the manifest SHA. 3. shellcheck-full / shell-lint: SC2034 (warning) is a false positive in library/helper .sh files that are consumed via `source`; shellcheck cannot follow dynamic source paths so it wrongly flags library variables as unused. Also fix SC2168 (local outside function) in test-reusable- issue.sh. Both hooks updated to --severity=error so genuine errors are still caught while warning-level false positives don't block pushes.
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughThis PR addresses JSON extraction robustness for action plans (fixing ChangesJSON Extraction and Action Plan Robustness
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|



Summary
Root cause (issue [test-finding] Issue agent fails to produce parseable action plan (escalates to needs-human) #93): The
(?R)Perl recursive regex inextract-plan.shtries to recursively match the full outer pattern, which requires every nested{}block to also contain"version":"<version>". Action plans with nested JSON objects (e.g.,params: {"reason":"...", "labels":["needs-human"]}) insideactions[]entries fail every parse attempt, causing the agent workflow to escalate every run as "unparseable."Fix: Replace
(?R)in Strategies B2, C (issue), C (pr), and E (issue) with a character-by-character depth tracker that correctly handles arbitrary nesting: walks the input finding balanced{…}blocks (tracking string context and escape sequences), filters by/"version"\s*:\s*"$v"/, and returns the last match so multi-attempt runs use the final output.Regression test: Adds a JSONL test case with nested
paramsobjects (bats test refactor(workflows): v3 dual-identity layout #9) that would have failed before this fix.Infra fixes (unblocked pre-push hooks):
auto-release.yml: SC2001/SC2086/SC2129 shellcheck findings fixed (sed→param-expansion, unquoted vars, grouped redirects)docs.yml: SHA drift from commit2c283d8reverted to matchmanifest.ymllefthook.yml:shellcheck-full/shell-lintupdated to--severity=errorso SC2034 false positives in library files sourced viasourcedon't block pushestest-reusable-issue.sh: SC2168 (localoutside function) fixedTest plan
bats tests/actions/issue-extract-plan.bats tests/actions/pr-extract-plan.bats)paramsobjects → correct plan extractedCloses #93
Need help on this PR? Tag
@codesmithwith what you need.Summary by CodeRabbit
Bug Fixes
Chores